package com.chinaums.cfps.apps.utils;

import com.chinaums.ibmmq.MQ;
import com.chinaums.ibmmq.MQQueue;
import com.chinaums.ibmmq.MQServer;

/**
 * 接收队列工厂类
 * @author cyshao
 *
 */
public class CfpsMQFactoryRcvQueueImpl  implements CfpsMQFactory {
	private String hostName;
	private int port;
	private String queueManager;
	private String channel;
	private String queueName;
	private String projectName;
	private String moduleName;
	private MQServer mqServer;
	private MQQueue mqQueue;
	
	/**
	 * 构造函数
	 */
	public CfpsMQFactoryRcvQueueImpl(String hostName, int port,
			String queueManager, String channel, String queueName,
			String projectName, String moduleName) {
		super();
		this.hostName = hostName;
		this.port = port;
		this.queueManager = queueManager;
		this.channel = channel;
		this.queueName = queueName;
		this.projectName = projectName;
		this.moduleName = moduleName;
	}

	/**
	 * 创建接收队列
	 */
	public MQ create() {
		mqServer = new MQServer(hostName, port, queueManager, channel);
		mqQueue = new MQQueue(mqServer, queueName, null, projectName, moduleName, MQQueue.ACTION_TYPE_RECV, false);
		return mqQueue;
	}

}
